module test_sph_load_rigid
    use sph_load_lua
    use testdrive
    use sph_region_type
    use seakeeping_filesystem
    use test_sph_meson
contains
    subroutine collect_load_rigid(test_suite)
        type(unittest_type), allocatable, intent(out) :: test_suite(:)

        test_suite = [ &
                     new_unittest("sub: load_lua_script", test_load_lua_script) &
                     ]

    end subroutine collect_load_rigid

    subroutine test_load_lua_script(error)
        type(error_type), allocatable, intent(out) :: error
        type(region_t) :: rigid_region
        if (env%is_meson_devenv) then
            call load_lua_script(env%path.join.'load_rigid'.join.'pif.lua', rigid_region)
        else
            call load_lua_script('example'.join.'load_rigid'.join.'pif.lua', rigid_region)
        end if
        call check(error, rigid_region%nreal, 4)
        if (allocated(error)) return
        call check(error, rigid_region%nvirt, 0)
        if (allocated(error)) return
        call check(error, rigid_region%hsml, 1.0000_rk)
        if (allocated(error)) return
        call check(error, rigid_region%dim, 2)
    end subroutine test_load_lua_script

end module test_sph_load_rigid
